package com.sh.test;

import com.sh.promise.IPromise;
import com.sh.promise.Promise;
import com.sh.promise.PromiseExecutor;
import com.sh.promise.PromiseHandler;
import com.sh.promise.then.OnCompleteListener;

/**
 * @Date 13:16 2023/3/9
 **/
public class Demo02 {
    public static void main(String[] args) {
        IPromise promise = new Promise.Builder().promiseHandler(executor -> 3).build();
        new Promise.Builder().promise(promise).promiseHandler(executor -> {
            Object promiseInput = executor.getPromiseInput();
            System.out.println("传进来的promise的结果 = " + promiseInput);
            return Integer.parseInt(promiseInput.toString()) * 2;
        }).build().addListener((resolvedData, e) -> System.out.println("resolvedData = " + resolvedData));
    }
}
